#!/usr/bin/env bash

#kubeadm  init --pod-network-cidr 172.16.0.0/16  --control-plane-endpoint master0:6443   --kubernetes-version v1.19.1   --upload-certs > /tmp/k8s-init.log 2>&1


systemctl enable kubelet
#systemctl start  kubelet

#kubeadm  init --pod-network-cidr 172.16.0.0/16  \
#              --apiserver-advertise-address  192.168.122.1  --apiserver-bind-port 6443  \
#              --control-plane-endpoint 192.168.122.1:6443 \
#			  --kubernetes-version v1.19.2   \
#			  --upload-certs
if  kubeadm init --config=kubeadm-config.yaml --upload-certs  > kubeadm-init.log 2>&1
then
   echo "$(date) ----kubeadm init is successful----"
   echo "$(date) kubeadm init ok"  >>  kubeadm-init.log
else
   echo "$(date) ----kubeadm init is failed----"
   echo "$(date) kubeadm init failed"  >> kubeadm-init.log
fi

